﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tilver.Coder.DBTextStyle;
using Tilver.Coder.Core;

namespace Tilver.Coder.Utility
{
    public static class DBTextStyleUtil
    {
        private static DBTextStyleBase _MSSql = new MSSqlTextStyle();
        private static DBTextStyleBase _Oracle = new OracleTextStyle();
        private static DBTextStyleBase _MySQL = new MySqlTextStyle();

        /// <summary>
        /// 根据数据库类型返回数据库文本样式操作对象
        /// </summary>
        /// <param name="dataProviderType"></param>
        /// <returns></returns>
        public static DBTextStyleBase GetDBTextStyle(DataProviderTypeEnum dataProviderType)
        {
            switch (dataProviderType)
            {
                case DataProviderTypeEnum.MSSQL:
                    return _MSSql;
                case DataProviderTypeEnum.Oracle:
                    return _Oracle;
                case DataProviderTypeEnum.MySQL:
                    return _MySQL;
                default:
                    throw new InvalidOperationException();
            }
        }
    }
}
